﻿using System.Collections;
using System.Collections.Generic;
using System.Threading.Tasks;
using JX.Core;
using JX.Core.Entity;

namespace JX.Application
{
	/// <summary>
	/// 数据库表：Dictionary 的应用层服务接口.
	/// </summary>
	public partial interface IDictionaryServiceAppDapper : IServiceAppDapper<DictionaryEntity>
	{
		/// <summary>
		/// 根据条件得到Dictionary表的实体类
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="fieldName"></param>
		/// <returns></returns>
		DictionaryEntity Get(string tableName, string fieldName);
		/// <summary>
		/// 根据条件得到Dictionary表的实体类
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="fieldName"></param>
		/// <returns></returns>
		Task<DictionaryEntity> GetAsync(string tableName, string fieldName);

		/// <summary>
		/// 得到数据字典中字段定义的值的集合类
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="fieldName"></param>
		/// <returns></returns>
		IList<DictionaryValue> GetDictionaryFieldValue(string tableName, string fieldName);
		/// <summary>
		/// 得到数据字典中字段定义的值的集合类
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="fieldName"></param>
		/// <returns></returns>
		Task<IList<DictionaryValue>> GetDictionaryFieldValueAsync(string tableName, string fieldName);
		/// <summary>
		/// 得到数据字典中字段定义的值的集合类
		/// </summary>
		/// <param name="entity"></param>
		/// <param name="isShowEnable">是否只显示已启用的值(true：只显示已启用的；false：全部；)</param>
		/// <returns></returns>
		IList<DictionaryValue> GetDictionaryFieldValue(DictionaryEntity entity,bool isShowEnable=false);
		/// <summary>
		/// 得到数据字典中字段定义的值的集合类
		/// </summary>
		/// <param name="entity"></param>
		/// <param name="isShowEnable">是否只显示已启用的值(true：只显示已启用的；false：全部；)</param>
		/// <returns></returns>
		Task<IList<DictionaryValue>> GetDictionaryFieldValueAsync(DictionaryEntity entity, bool isShowEnable = false);

		/// <summary>
		/// 设置字段的值
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="fieldName"></param>
		/// <param name="fieldValue"></param>
		/// <returns></returns>
		bool SetFieldValue(string tableName, string fieldName, string fieldValue);
		/// <summary>
		/// 设置字段的值
		/// </summary>
		/// <param name="tableName"></param>
		/// <param name="fieldName"></param>
		/// <param name="fieldValue"></param>
		/// <returns></returns>
		Task<bool> SetFieldValueAsync(string tableName, string fieldName, string fieldValue);
	}
}